﻿using System.Collections.Generic;
using System.Windows.Data;
using System;
using System.Globalization;

namespace WebSilverlight.Helpers
{
	public partial class EnumerationsCodes
    {
        public string Text { get; set; }
        public string TextValue { get; set; }
        public Int16 ShortValue { get; set; }
        public Int32 IntValue { get; set; }
        public Int64 LongValue { get; set; }
        public Double DoubleValue { get; set; }       
    }
    public class EnumerationsHelper
    {
		public static List<EnumerationsCodes> GenderEnumSelectList
        {
            get
            {
				List<EnumerationsCodes> list = new List<EnumerationsCodes>();
				EnumerationsCodes item;
				item = new EnumerationsCodes();
				item.ShortValue = 1;
				item.Text = "Hombre";
				list.Add(item);
				item = new EnumerationsCodes();
				item.ShortValue = 2;
				item.Text = "Mujer";
				list.Add(item);
				return list;
            }
        }
		public static List<EnumerationsCodes> ProductClassSelectList
        {
            get
            {
				List<EnumerationsCodes> list = new List<EnumerationsCodes>();
				EnumerationsCodes item;
				item = new EnumerationsCodes();
				item.ShortValue = 1;
				item.Text = "Combo 1";
				list.Add(item);
				item = new EnumerationsCodes();
				item.ShortValue = 2;
				item.Text = "clase 2";
				list.Add(item);
				item = new EnumerationsCodes();
				item.ShortValue = 3;
				item.Text = "Clase3";
				list.Add(item);
				item = new EnumerationsCodes();
				item.ShortValue = 4;
				item.Text = "clase4";
				list.Add(item);
				item = new EnumerationsCodes();
				item.ShortValue = 5;
				item.Text = "clase5";
				list.Add(item);
				item = new EnumerationsCodes();
				item.ShortValue = 6;
				item.Text = "clase6";
				list.Add(item);
				item = new EnumerationsCodes();
				item.ShortValue = 7;
				item.Text = "clase7";
				list.Add(item);
				item = new EnumerationsCodes();
				item.ShortValue = 8;
				item.Text = "clase8";
				list.Add(item);
				return list;
            }
        }
    }
	public class GenderEnumConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
            {
                try
                {
					string text = "";					                    
                    System.Int16 enumvalue = (System.Int16)value;
					if (enumvalue == 1){
						text = "Hombre";
					}
					if (enumvalue == 2){
						text = "Mujer";
					}
					return text;  
                }
                catch (Exception)
                {                                      
                }
            }
            return string.Empty;            
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
            {
                try
                {
					string text = (string)value;					                    
                    System.Int16 enumvalue = 0;
					if (text == "Hombre"){
						enumvalue = 1;
					}
					if (text == "Mujer"){
						enumvalue = 2;
					}
					return enumvalue; 
                }
                catch (Exception)
                {                                    
                }
            }           
            return string.Empty;
        }
	}		
	public class ProductClassConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
            {
                try
                {
					string text = "";					                    
                    System.Int16 enumvalue = (System.Int16)value;
					if (enumvalue == 1){
						text = "Combo 1";
					}
					if (enumvalue == 2){
						text = "clase 2";
					}
					if (enumvalue == 3){
						text = "Clase3";
					}
					if (enumvalue == 4){
						text = "clase4";
					}
					if (enumvalue == 5){
						text = "clase5";
					}
					if (enumvalue == 6){
						text = "clase6";
					}
					if (enumvalue == 7){
						text = "clase7";
					}
					if (enumvalue == 8){
						text = "clase8";
					}
					return text;  
                }
                catch (Exception)
                {                                      
                }
            }
            return string.Empty;            
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
            {
                try
                {
					string text = (string)value;					                    
                    System.Int16 enumvalue = 0;
					if (text == "Combo 1"){
						enumvalue = 1;
					}
					if (text == "clase 2"){
						enumvalue = 2;
					}
					if (text == "Clase3"){
						enumvalue = 3;
					}
					if (text == "clase4"){
						enumvalue = 4;
					}
					if (text == "clase5"){
						enumvalue = 5;
					}
					if (text == "clase6"){
						enumvalue = 6;
					}
					if (text == "clase7"){
						enumvalue = 7;
					}
					if (text == "clase8"){
						enumvalue = 8;
					}
					return enumvalue; 
                }
                catch (Exception)
                {                                    
                }
            }           
            return string.Empty;
        }
	}		
}